﻿package mortal.game.view.forging.renderer
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.forging.view.*;

    public class GemEmbedCellRenderer extends GCellRenderer
    {
        private var _itemData:ItemData;
        private var _gemItem:GemItem;
        private var _disabledBg:GBitmap;

        public function GemEmbedCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._gemItem = UICompomentPool.getUICompoment(GemItem);
            this.addChild(this._gemItem);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:ItemData = null;
            this._gemItem.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            if (param1.hasOwnProperty("gemData"))
            {
                _loc_2 = param1.gemData as ItemData;
                this._gemItem.itemData = _loc_2;
                this._gemItem.isShowLevel = true;
                if (param1.gemType != 0)
                {
                    if (param1.gemType != _loc_2.itemInfo.type)
                    {
                        this._gemItem.isUseable = false;
                        this._gemItem.isLight = false;
                    }
                    else
                    {
                        this._gemItem.isUseable = true;
                        this._gemItem.isLight = true;
                    }
                }
                else
                {
                    this._gemItem.isUseable = true;
                    this._gemItem.isLight = true;
                }
            }
            else
            {
                this._gemItem.itemData = null;
                this._gemItem.isShowLevel = false;
                this._gemItem.isUseable = true;
                this._gemItem.isLight = false;
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._gemItem.dispose(param1);
            this._gemItem = null;
            return;
        }// end function

    }
}
